package com.kiln.juxingqs.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.kiln.juxingqs.AlwaysMarqueeTextView
import com.kiln.juxingqs.R
import com.kiln.juxingqs.api.bean.Norification
import com.youth.banner.adapter.BannerAdapter


class SyNotiBannerAdapter(val datas: List<Norification.Notic>) :
    BannerAdapter<Norification.Notic, SyNotiBannerAdapter.BannerViewHolder>(datas) {

    class BannerViewHolder(val imageView: View) : RecyclerView.ViewHolder(imageView)

    override fun onCreateHolder(parent: ViewGroup?, viewType: Int): BannerViewHolder {
        return BannerViewHolder(
            LayoutInflater.from(parent?.getContext())
                .inflate(R.layout.tozhi, parent, false)
        )
    }

    override fun onBindView(
        holder: BannerViewHolder?,
        data: Norification.Notic,
        position: Int,
        size: Int
    ) {

        val txt = holder?.imageView?.findViewById<AlwaysMarqueeTextView>(R.id.txt)
        txt?.text = (data).text
        txt?.isFocusable = true
    }
}